//
//  AppDelegate.m
//  QuickAskCommunity
//
//  Created by ym on 14-8-11.
//  Copyright (c) 2014年 ___FULLUSERNAME___. All rights reserved.
//

#import "GGAppDelegate.h"

@interface GGAppDelegate ()
@end

@implementation GGAppDelegate

- (BOOL)application:(UIApplication *)application didFinishLaunchingWithOptions:(NSDictionary *)launchOptions {
    
    /*
     如有在所有服务之前执行的第三方or服务,在这里实现
     */

    if ([super respondsToSelector:@selector(application:didFinishLaunchingWithOptions:)]) {
        
        [super application:application didFinishLaunchingWithOptions:launchOptions];
    }
    return YES;
}

- (void)application:(UIApplication *)application didReceiveRemoteNotification:(NSDictionary *)userInfo fetchCompletionHandler:(void (^)(UIBackgroundFetchResult))completionHandler{
    
    
    if ([super respondsToSelector:@selector(application:didReceiveRemoteNotification:fetchCompletionHandler:)]) {
        
        [super application:application didReceiveRemoteNotification:userInfo fetchCompletionHandler:completionHandler];
    }
}

- (void)application:(UIApplication *)application didRegisterUserNotificationSettings:(UIUserNotificationSettings *)notificationSettings{
    
    
    
    if ([super respondsToSelector:@selector(application:didRegisterUserNotificationSettings:)]) {
        
        [super application:application didRegisterUserNotificationSettings:notificationSettings];
    }
}

- (void)application:(UIApplication *)application didRegisterForRemoteNotificationsWithDeviceToken:(NSData *)deviceToken{
    

    if ([super respondsToSelector:@selector(application:didRegisterForRemoteNotificationsWithDeviceToken:)]) {
        
        [super application:application didRegisterForRemoteNotificationsWithDeviceToken:deviceToken];
    }
}


- (void)applicationWillEnterForeground:(UIApplication *)application{
    
    if ([super respondsToSelector:@selector(applicationWillEnterForeground:)]) {
        
        [super applicationWillEnterForeground:application];
    }
}

- (void)application:(UIApplication *)application didReceiveRemoteNotification:(NSDictionary *)userInfo{
    
    if ([super respondsToSelector:@selector(application:didReceiveRemoteNotification:)]) {
        
        [super application:application didReceiveRemoteNotification:userInfo];
    }
}

- (void)application:(UIApplication *)application didReceiveLocalNotification:(UILocalNotification *)notification{
    
    if ([super respondsToSelector:@selector(application:didReceiveLocalNotification:)]) {
        
        [super application:application didReceiveLocalNotification:notification];
    }
}

- (void)applicationDidEnterBackground:(UIApplication *)application{
    if ([super respondsToSelector:@selector(applicationDidEnterBackground:)]) {
        
        [super applicationDidEnterBackground:application];
    }
    
}


- (void)applicationDidBecomeActive:(UIApplication *)application{
    
    if ([super respondsToSelector:@selector(applicationDidBecomeActive:)]) {
        
        [super applicationDidBecomeActive:application];
    }
    
}
- (BOOL)application:(UIApplication *)app openURL:(NSURL *)url options:(NSDictionary<NSString *,id> *)options{
    
    if ([super respondsToSelector:@selector(application:openURL:options:)]) {
        
        [super application:app openURL:url options:options];
    }
    return YES;
}


- (BOOL)application:(UIApplication *)application handleOpenURL:(NSURL *)url{
    
    if ([super respondsToSelector:@selector(application:handleOpenURL:)]) {
        
        [super application:application handleOpenURL:url];
    }
    return YES;
}

- (BOOL)application:(UIApplication *)application openURL:(NSURL *)url sourceApplication:(NSString *)sourceApplication annotation:(id)annotation{
    
    if ([super respondsToSelector:@selector(application: openURL:sourceApplication:annotation:)]) {
        
        [super application:application openURL:url sourceApplication:sourceApplication annotation:annotation];
    }
    return YES;
}

- (UIInterfaceOrientationMask)application:(UIApplication *)application supportedInterfaceOrientationsForWindow:(nullable UIWindow *)window{
    
    if (_allowRotation == YES) {
        
        return UIInterfaceOrientationMaskLandscapeLeft;
        
    }else{
        
        return (UIInterfaceOrientationMaskPortrait);
        
    }
    
}
//-(UIWindow *)window{
//    return [GGAppDelegatePublicHandler sharedInstance].window;
//}
@end

